FROM ccr.ccs.tencentyun.com/mkmk-common/ymk:golang-1.21.5-bullseye as builder
USER root
WORKDIR /gin_01

COPY *.go .
COPY go.mod .
COPY go.sum .
COPY demo_json/ demo_json/


RUN mkdir -p  /go/pkg/mod/cache

COPY cache/ /go/pkg/mod/cache/

RUN CGO_ENABLED=1 go build -race  -ldflags "-w -s -linkmode 'external' -extldflags '-static'" -tags=jsoniter   -o output/

RUN ls output/

FROM alpine

COPY --from=builder /gin_01/output/* /app/
EXPOSE 8080

USER root
ENTRYPOINT [ "/app/gin_01" ]

